//package com.jianqiao.delivery.util;
//
//import org.bouncycastle.jce.provider.BouncyCastleProvider;
//import org.bouncycastle.openssl.jcajce.JcaPEMReader;
//import org.bouncycastle.util.io.pem.PemObject;
//
//import java.io.FileReader;
//import java.io.IOException;
//import java.security.KeyPair;
//import java.security.KeyPairFactory;
//import java.security.KeyStore;
//import java.security.PrivateKey;
//import java.security.Security;
//import java.security.cert.CertificateException;
//import java.security.cert.X509Certificate;
///**
// * author: cyx
// * create: 2024/11/23 17:56
// **/
//public class PEMUtils {
//    public static X509Certificate decodeX509Certificate(byte[] pemBytes) throws CertificateException, IOException {
//        try (JcaPEMReader pemReader = new JcaPEMReader(new java.io.ByteArrayInputStream(pemBytes))) {
//            PemObject pemObject = pemReader.readPemObject();
//            return (X509Certificate) pemReader.readCertificate();
//        }
//    }
//
//    public static PrivateKey decodePrivateKey(byte[] pemBytes) throws IOException, java.security.spec.InvalidKeySpecException {
//        try (JcaPEMReader pemReader = new JcaPEMReader(new java.io.ByteArrayInputStream(pemBytes))) {
//            PemObject pemObject = pemReader.readPemObject();
//            return pemReader.readPrivateKey();
//        }
//    }
//}
